package com.merelyb.data.service.service.service.affpay;

import com.merelyb.data.service.common.MultiDataSourceContextHolder;
import com.merelyb.data.service.service.mybatis.bean.affpay.AffpayCommission;
import com.merelyb.data.service.service.mybatis.dao.affpay.AffpayCommissionDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by LiM on 2017/12/15.
 */
@Service
public class AffpayCommissionService {
    @Autowired
    AffpayCommissionDao affpayCommissionDao;


    /**
     * 查询数据
     *
     * @param affpayCommission
     * @return
     * @throws Exception
     */
    public List<AffpayCommission> queryAllList(AffpayCommission affpayCommission) throws Exception {
        return affpayCommissionDao.queryAllList(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 分页查询数据
     *
     * @param affpayCommission
     * @return
     */
    public List<AffpayCommission> queryListByLimit(AffpayCommission affpayCommission) {
        return affpayCommissionDao.queryListByLimit(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 新增单条数据
     *
     * @param affpayCommission
     * @throws Exception
     */
    public void addData(AffpayCommission affpayCommission) throws Exception {
        affpayCommissionDao.addData(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 批量新增数据
     *
     * @param affpayCommissionList
     * @throws Exception
     */
    public void addData(List<AffpayCommission> affpayCommissionList) throws Exception {
        affpayCommissionDao.addData(affpayCommissionList, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 更新数据
     *
     * @param affpayCommission
     * @throws Exception
     */
    public void updateData(AffpayCommission affpayCommission) throws Exception {
        affpayCommissionDao.updateData(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 更新数据状态
     *
     * @param affpayCommission
     * @throws Exception
     */
    public void deleteData(AffpayCommission affpayCommission) throws Exception {
        affpayCommissionDao.deleteData(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 统计数量
     *
     * @param affpayCommission
     * @return
     */
    public int getCount(AffpayCommission affpayCommission) {
        return affpayCommissionDao.getCount(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 获取所有任务类型
     * @param affpayCommission
     * @return
     * @throws Exception
     */
    public List<String> getAffpayCommission(AffpayCommission affpayCommission) throws Exception {
        return affpayCommissionDao.getAllPayCommissionType(affpayCommission, MultiDataSourceContextHolder.DATA_AFFPAY);
    }
}
